package com.htc.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.htc.model.Classes;

public interface ClassesMapper {
    
	@Select("SELECT *,(select cname from classes c where c.cid=classes.pid)pname from classes ${where} ORDER BY pid ASC")
    List<Classes> queryList(@Param("where")String where);
    
	@Delete("delete from classes where cid=#{id} or pid = #{id}")
    void del(@Param("id")int id);

	@Update("update classes set cname=#{cname},pid=#{pid} where cid=#{cid} ")
    void update(Classes classes);
    
	@Insert("insert into classes (cname,pid) values(#{cname},#{pid})")
    void insert(Classes classes);
    
}